from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User

from django.forms.fields import ChoiceField
from constants import VERMONT_COUNTIES

import sys
sys.path.append("..")

def_max_length = 255

class Farm(models.Model):
    farm_name = models.CharField(max_length=def_max_length)
    contact_person_first_name = models.CharField(max_length=def_max_length)
    contact_person_last_name = models.CharField(max_length=def_max_length)
    county = ChoiceField(label=u'County Choice 1', choices = VERMONT_COUNTIES, initial = '7')
    address = models.CharField(max_length=def_max_length)
    phone_1 = models.CharField(max_length=def_max_length)
    phone_2 = models.CharField(max_length=def_max_length)
    email = models.CharField(max_length=def_max_length)
    direction = models.TextField()
    instructions = models.TextField()
    user = models.ForeignKey(User)    
    
    def __str__(self):
        return self.farm_name

# Create your models here.
class GleanEvent(models.Model):
    number_volunteers_needed = models.IntegerField()
    email = models.CharField(max_length=def_max_length)
    crop_type = models.CharField(max_length = def_max_length)
    event_datetime = models.DateTimeField()
    farm = models.ForeignKey(Farm)
    instructions = models.TextField()
    
    
### Admin
admin.site.register(Farm)
admin.site.register(GleanEvent)


    

    
    
    
    
    
    
